home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Internet / Misc / NGService / Source / MMDocumentCell.m < prev    next >
Encoding:
Text File  |  1995-06-12  |  949 b   |  49 lines

  1. /*
  2.  *      You may freely copy, distribute and reuse the code
  3.  *      in this example.  Scott Anguish disclaims any warranty of
  4.  *      any kind, expressed or implied, as to its fitness
  5.  *      for any particular use.
  6.  *        Please keep this notice intact
  7.  *      Written by: Scott Anguish  sanguish@digifix.com
  8.  */
  9.  
  10. #import "MMDocumentCell.h"
  11.  
  12. #import <libc.h>                      /* MAXPATHLEN */
  13. #import <stdio.h>
  14. #import <strings.h>
  15.  
  16. #import <appkit/appkit.h>
  17.  
  18. #import <streams/streams.h>
  19.  
  20.  
  21. @implementation MMDocumentCell:MMCell
  22.  
  23. - imageFromFilename:(const char *)filename
  24. {
  25.  
  26.     if (!theImage)
  27.             {
  28.             theImage=[[Application workspace] getIconForFile:filename];
  29.             
  30.             if (!theImage){ 
  31.                     theImage = [[NXImage alloc] initFromFile: "/usr/lib/nib/default_app_icon.tiff" ];
  32.                     }
  33.             }    
  34.     return self;
  35.  
  36. }
  37.  
  38. - imageFromAttachment
  39. {
  40.     char filename[MAXPATHLEN+1];
  41.  
  42.  
  43.     sprintf(filename,"/tmp/%s",attachmentName);
  44.     [self imageFromFilename:filename];
  45.     return self;
  46. };
  47.  
  48. @end
  49.